package com.ferryc.fegin;

import com.ferryc.entity.Stroage;
import com.ferryc.fegin.hystrix.StroageServiceFallbackFactory;
import com.ferryc.model.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by Ferry Chen on 2019/11/13.
 */

@FeignClient(name = "stroage-service", fallbackFactory = StroageServiceFallbackFactory.class,path = "/stroage")
public interface StroageFeignClient {

    @PostMapping("/add")
    public Result add(@RequestParam(value = "productId") String productId,
                      @RequestParam(value = "count") int count);

    @PostMapping("/consume")
    public Result consume(@RequestParam(value = "productId") String productId,
                          @RequestParam(value = "count") int count);

    @GetMapping("/getByProductId")
    public Result<Stroage> getByProductId(@RequestParam(value = "productId") String productId);
}
